package cn.class2.demo6

/**
  * Created by lzd on 2018/11/14.
  * fun1 偏函数
  * fun2 正常函数
  */
object Demo7 {
  def main(args: Array[String]): Unit = {

    fun2("one")
    println(fun1("two"))

  }

  def fun1: PartialFunction[String, Int] = {
    case "one" => 1
    case _ => 2
  }

  def fun2(name: String): Unit = name match {
    case "one" => println("success...")
    case _ => println("no ...")
  }
}
